import stm
from micropython import const
from machine import WDT

wdt = None
time_count = 0

def wdt_start():
	global wdt
	wdt = WDT(timeout = 30000)

def wdt_feed():
	global wdt
	if (wdt != None):
		wdt.feed()

def writeBKSRAM(idx, data):
	stm.mem32[stm.RTC + stm.RTC_BKP0R + idx * 4] = data

def readBKSRAM(idx):
	return stm.mem32[stm.RTC + stm.RTC_BKP0R + idx * 4]
